package com.lizongbo.seotijian.rules;

import java.net.URI;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import com.lizongbo.seotijian.CheckRule;

public abstract class AbstractCheckRule implements CheckRule {
	protected int maxPoint = 0;
	protected int currentPoint = 0;
	protected String suggest = "";
	protected String descption = "";
	protected String ruleName = "";
	java.util.Map<String, String> headers = new HashMap<String, String>();
	java.util.Map<String, Object> context = new HashMap<String, Object>() {

		@Override
		public Object get(Object key) {
			return super.get(key);
		}

	};

	public int getMaxPoint() {
		return maxPoint;
	}

	public void setMaxPoint(int maxPoint) {
		this.maxPoint = maxPoint;
		context.put("maxPoint", maxPoint);
	}

	public int getCurrentPoint() {
		return currentPoint;
	}

	public void setCurrentPoint(int currentPoint) {
		this.currentPoint = currentPoint;
		context.put("currentPoint", currentPoint);
	}

	public String getSuggest() {
		return suggest;
	}

	public void setSuggest(String suggest) {
		this.suggest = suggest;
		context.put("suggest", suggest);
	}

	public String getDescption() {
		return descption;
	}

	public void setDescption(String descption) {
		this.descption = descption;
		context.put("descption", descption);
	}

	public String getRuleName() {
		return ruleName;
	}

	public void setRuleName(String ruleName) {
		this.ruleName = ruleName;
		context.put("ruleName", ruleName);
	}

	@Override
	public void setHeaders(HttpServletRequest req) {
		for (String headerName : (List<String>) Collections.list(req
				.getHeaderNames())) {
			headers.put(headerName, req.getHeader(headerName));
		}
	}

}
